﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
using DataAccess.SqlClient;
using Model;
namespace DAL
{
  public  class sy_CounselingDAL
    {
        /// <summary>
        /// 首页健康资讯表
        /// </summary>
        /// <returns></returns>
      public static dynamic sy_Counselingshow()
        {
            SqlQuery q = new SqlQuery
            {
                CommandText = "select top 10 ROW_NUMBER() over(order by intime) nid,* from Counseling ",
            };
            var dt = SqlDataAccess.ExecDataset(q).Tables[0];//连接数据库，获取首页健康资讯表
            var list = new List<dynamic>();
            foreach (var dr in dt.Select())
            {
                list.Add(

                    new
                    {
                        CounselingTID = dr.Field<Guid>("CounselingTID"),
                        CounselingID = dr.Field<Guid>("CounselingID"),
                        Title = dr.Field<string>("Title"),
                        InTime = dr.Field<DateTime>("InTime").ToString(),
                        CounImage = dr.Field<string>("CounImage"),
                        Counts = dr.Field<int>("Counts"),
                        Content = dr.Field<string>("Content"),
                        jianjie = dr.Field<string>("jianjie"),
                    }
                    );
            }
            return list;
        }
    }
}
